package com.snopy.lambda;

/**
 * @author snopy
 * @version 1.0.0
 * @classname Calculator
 * @description
 * @email 77912204@qq.com
 * @date 2022/07/23 1:19
 */
public class Calculator {
        interface IntegerMath{
            int operation(int a,int b);
        }
        public int operateBinary(int a,int b,IntegerMath op){
            return op.operation(a,b);
        }

    public static void main(String[] args) {
        Calculator calculator = new Calculator();
        IntegerMath addition = (a, b) -> a + b;
        IntegerMath multi = (a, b) -> a * b;
        int sum = calculator.operateBinary(2, 4, addition);
        System.out.println(sum);
        int product = calculator.operateBinary(4,9,multi);
        System.out.println(product);
    }

}
